
	function formatCurrency(amount)
	{
		amount = new String(amount);
		var amountLength = amount.length;
		var modulus = amountLength % 3;
		var currencyString = amount.substr(0,modulus);
		
		for(i=modulus; i<amountLength; i=i+3) 
		{
	  		if(currencyString != "")
	   			currencyString += ",";
	  
	  		currencyString += amount.substr(i, 3);
		}
		
	 	return currencyString;
	}

	function Request(valuename) 
	{
		var rtnval = "";
		var nowAddress = unescape(location.href);
		var parameters = (nowAddress.slice(nowAddress.indexOf("?")+1,nowAddress.length)).split("&");
	
		for(var i = 0 ; i < parameters.length ; i++)
		{
			var varName = parameters[i].split("=")[0];
			if(varName.toUpperCase() == valuename.toUpperCase())
			{
				rtnval = parameters[i].split("=")[1];
				break;
			}
		}
		
		return rtnval;
	}
	
	function time(sec)
	{
		var hour = parseInt(sec/3600);
		var min = parseInt((sec - (3600 * hour)) / 60);
		var sec = parseInt(sec - (3600 * hour) - (min * 60));
		
		var time = "";
		
		if(hour > 0)
			time = hour + ":";
		
		if(min < 10)
			time += "0" + min + ":";
		else
			time += min + ":";
		
		if(sec < 10)
			time += "0" + sec;
		else
			time += sec;
			
		return time;
	}
	
	function getData(url) 
	{
		var data;
	    $.ajax(
	    {
	        async: false, //thats the trick
	        url: url,
	        dataType: 'json',
	        success: function(response)
	        {
	           data = response;
	        }
	    });
	    return data;
	}